<%@codepage="65001"%>
<%session.codepage="65001"%>
<!-- #include virtual=/inc/dbConn.asp -->
<!-- #include virtual=/inc/function.asp -->
<!-- #include virtual=/inc/action.header.inc.asp -->

<%
	'## 파라미터 변수 선언부
	startDt		= Request("findStartDt")
	endDt		= Request("findEndDt")
	userId		= Request("findUserId")

	SQLTitle = "-- ■■■■ 휴일 근무 정보 그리드 List up ■■■■"
	
	'## 검색조건에 따른 조건절 만들기 
	If startDt <> "" Then 
		addSql = " A.workDt >='" & startDt & "' "
	End If 
	If endDt <> "" Then 
		If addSql <> "" Then addSql = addSql & " AND "
		addSql = addSql & " A.workDt <='" & endDt & "' "
	End If 
	If userId <> "" Then 
		If addSql <> "" Then addSql = addSql & " AND "
		addSql = addSql & " A.userId ='" & userId & "' "
	End If 

	If addSql <> "" Then 
		addSql = " WHERE " & addSql 
	End If 

	SQL = "SELECT A.workDt, A.workTm, B.userNm, A.seq, A.flag " & _
			"	FROM tblOffDayWork A LEFT JOIN tblUser B ON A.userId=B.userId " & addSql & _
			"	ORDER BY A.workDt DESC, B.userNm, A.flag DESC" 

	If xMode="debug" Then 
		Call showDebug(SQLTitle,SQL) 
	End If 

	Set Rs=Server.CreateObject("ADODB.RecordSet")
	Rs.open SQL, DbCon, 1
	
	Response.write "<OffWork>" & vbcrlf

	If Rs.eof Or Rs.bof Then 
	Else 
		Do Until Rs.eof Or Rs.bof
			
			Response.write "	<OffDayWork>" & vbcrlf
				Call mkXMLNode("seq", rs("seq"), 2)
				Call mkXMLNode("workDt", rs("workDt"), 2)
				Call mkXMLNode("workTm", rs("workTm"), 2)
				Call mkXMLNode("userNm", rs("userNm"), 2)
				Call mkXMLNode("flag", Rs("flag"), 2)
			Response.write "	</OffDayWork>" & vbcrlf

		Rs.movenext
		Loop 
	End If
	Response.write "</OffWork>" & vbcrlf
'	Call rsWithXML("Save OK!")
%>